checkCallingPermission

open fun checkCallingPermission(@NonNull context: Context, @NonNull permission: String, @Nullable packageName: String): Int(source)

Checks whether the IPC you are handling has a given permission and whether the app op that corresponds to this permission is allowed.

Return

The permission check result which is either PERMISSION_GRANTED or PERMISSION_DENIED or PERMISSION_DENIED_APP_OP.

Parameters

context

Context for accessing resources.

permission

The permission to check.

packageName

The package name making the IPC. If null the the first package for the calling UID will be used.